#include <iostream>
#include <vector>
#include <list>
#include <stdexcept>
using namespace std;
bool find_val(vector<int>::const_iterator begin,vector<int>::const_iterator end,int val);
vector<int>::const_iterator finds(vector<int>::const_iterator begin,vector<int>::const_iterator end,int val);
void practice_9_4();
void practice_9_5();
void practice_9_11();
void practice_9_13();
void practice_9_14();
int main()
{
	//practice_9_4();
	//practice_9_5();
	//practice_9_13();
	practice_9_14();
	return 0;
}
bool find_val(vector<int>::const_iterator begin,vector<int>::const_iterator end,int val)
{
	while(begin!=end)
	{
		if(*begin++==val)
			return true;
	}
	return false;
}
vector<int>::const_iterator finds(vector<int>::const_iterator begin,vector<int>::const_iterator end,int val)
{
	while(begin!=end)
	{
		if(*begin++==val)
			return begin-1;
	}
	throw runtime_error("the val isn't exist");
}
void practice_9_4()
{
	vector<int> v{1,3,5,7,9};
	cout<<find_val(v.cbegin(),v.cend(),7)<<endl;
}
void practice_9_5()
{
	vector<int> v{1,3,5,7,9};
	cout<<*finds(v.cbegin(),v.cend(),5)<<endl;
}
void practice_9_11()
{
	vector<int> v={1,2,3,4};
	vector<int> v1(v);
	vector<double> v2(v.cbegin(),v.cend());
}
void practice_9_13()
{
	list<int> li={1,3,5,6,8};
	vector<double> v(li.begin(),li.end()); 
	for(auto &c:v){
		cout<<c<<" ";
	}
}
void practice_9_14()
{
	list<char *>li{"abc","def","hij"};
	vector<string> v;
	v.assign(li.cbegin(),li.cend());
	for(const auto &s:v)
		cout<<s<<" ";
}